package com.cjg.xiancheng;

public class threadJoin implements  Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName()+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        threadJoin threadJoin = new threadJoin();
        Thread thread = new Thread(threadJoin, "vip");
                thread.start(); //线程已经开始

        for (int i = 0; i < 500; i++) {
            System.out.println(Thread.currentThread().getName()+i);
            if (i==100){
                //知道join线程结束都只执行join线程
                thread.join();
            }
        }
    }
}
